import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { elevatorInfoVO, elevatorInfoForm, elevatorInfoQuery } from '@/api/elevator/elevator-info/types';

/**
 * 查询电梯信息列表
 * @param query
 * @returns {*}
 */

export const listelevatorInfo = (query?: elevatorInfoQuery): AxiosPromise<elevatorInfoVO[]> => {
  return request({
    url: '/elevator/elevator-info/list',
    method: 'get',
    params: query
  });
};
/**
 * 查询电梯信息列表
 * @param query
 * @returns {*}
 */

export const listelevator = (query?: elevatorInfoQuery): AxiosPromise<elevatorInfoVO[]> => {
  return request({
    url: '/user/user-elevator/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询电梯信息详细
 * @param elevatorInfoId
 */
export const getelevatorInfo = (elevatorInfoId: string | number): AxiosPromise<elevatorInfoVO> => {
  return request({
    url: '/elevator/elevator-info/' + elevatorInfoId,
    method: 'get'
  });
};

/**
 * 新增电梯信息
 * @param data
 */
export const addelevatorInfo = (data: elevatorInfoForm) => {
  return request({
    url: '/elevator/elevator-info',
    method: 'post',
    data: data
  });
};

/**
 * 修改电梯信息
 * @param data
 */
export const updateelevatorInfo = (data: elevatorInfoForm) => {
  return request({
    url: '/elevator/elevator-info',
    method: 'put',
    data: data
  });
};

/**
 * 删除电梯信息
 * @param elevatorInfoId
 */
export const delelevatorInfo = (elevatorInfoId: string | number | Array<string | number>) => {
  return request({
    url: '/elevator/elevator-info/' + elevatorInfoId,
    method: 'delete'
  });
};
